package Month07.day28.test2;

import java.util.Comparator;
import java.util.TreeMap;

public class main {
    public static void main(String[] args) {
        TreeMap<Student, String> map = new TreeMap<>(new Comparator<Student>() {
            @Override
            public int compare(Student o1, Student o2) {
                 int result=o1.getName().compareTo(o2.getName());
                 result=result==0?o1.getAge()-o2.getAge():result;
                return result;
            }
        });
        Student student = new Student("yuank",17);
        Student student1 = new Student("nk",12);
        Student student2 = new Student("uank",15);
        map.put(student,"江苏");
        map.put(student1,"江西");
        map.put(student2,"江东");
        System.out.println(map);
    }
}
